<template>
  <el-dialog
    :close-on-click-modal="false"
    top="5vh"
    width="85%"
    :title="title"
    :visible.sync="visible"
    :before-close="close"
    lock-scroll
    append-to-body
  >
    <el-form status-icon ref="addEdit">
      <el-row :gutter="10">
        <el-col :span="24">
          <el-table
            v-loading="loading"
            :header-cell-style="{ background: '#eef1f6', color: '#606266' }"
            :data="tableData"
            border
            max-height="380"
            size="mini"
            style="width: 100%"
          >
            <el-table-column prop="name" label="考核标准">
              <template slot-scope="scope">
                <span class="html-content" v-html="scope.row.name"></span>
              </template>
            </el-table-column>
            <el-table-column
              :show-overflow-tooltip="true"
              prop="orgname"
              label="部门"
              width="300"
            ></el-table-column>
          </el-table>
        </el-col>
      </el-row>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="close">取 消</el-button>
      <el-button :type="'primary'" :loading="loadingBtn" @click.native="save()"
        >保存</el-button
      >
    </div>
  </el-dialog>
</template>

<script>
import { Message } from "element-ui";
import perAPI from "@apis/performance";

export default {
  name: "addEdit",
  props: {
    visible: Boolean,
    title: String,
    datas: {
      type: String,
    },
    saveForm: Function,
  },
  data() {
    return {
      loading: false,
      loadingBtn: false,
      tableData: [],
    };
  },
  computed: {},
  components: {},
  created() {
    this.loading = true;
    this.getList(1);
  },
  methods: {
    //获取table数据
    getList(val) {
      perAPI
        .getKHYLlist({ pageNo: 1, pageSize: 1000 })
        .then((res) => {
          this.tableData = [...res[0]];
          this.loading = false;
        })
        .catch((err) => {
          this.loading = false;
          this.$message.error(err.message);
        });
    },
    close() {
      this.loadingBtn = false;
      this.$emit("update:visible", false);
    },
    save() {
      this.loadingBtn = true;
      this.$emit("saveForm");
    },
  },
};
</script>
<style lang="scss" scoped>
</style>